import request from '@/utils/request'
import processRichText from "@/utils/processRichText"
import { ref } from 'vue'
export default () => {
	const groupcourses = ref([])
	const groupcourse = ref({})
	const getGroupCourse = async (show_mini) => {
		groupcourses.value = await request.get(`mini/groupcourse/list?show_mini=${show_mini}`)
	}

	const loadGroupcourse = async (id) => {
		let data = await request.get(`mini/groupcourse/${id}/one`)
		data.introduction = processRichText(data.introduction)
		groupcourse.value = data
	}
	return {
		getGroupCourse,
		groupcourses,
		groupcourse,
		loadGroupcourse,
	}
}